using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Evolution.Engine.Interfaces;

namespace Evolution.Engine.Managers
{
    public class LevelManager : Singleton<LevelManager>
    {
        private Hashtable _Levels = new Hashtable();
        private string _CurrentLevel;

        public ILevel Level
        {
            get
            {
                if (string.IsNullOrEmpty(_CurrentLevel)) return null;
                return _Levels[_CurrentLevel] as ILevel;
            }
        }

        public void Add(string Name, string LevelFile)
        {
            ILevel lev = ScriptManager.Instance.Get<ILevel>(LevelFile, "Level");
            _Levels.Add(Name, lev);
            _CurrentLevel = Name;
            
            if (lev != null)
            {
                lev.IntitalizeLevel();
                lev.LoadGraphicsContent();
            }
        }

        public void SetLevel(string Name)
        {
            _CurrentLevel = Name;
        }
    }
}
